package movee.domain.query;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.google.common.collect.Lists;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.SchemaProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;

/**
 *
 *
 * @author movee
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Schema(description = "查询设备备份配置")
@JsonIgnoreProperties(ignoreUnknown = true)
public class AppConfigSearchQuery {

    @SchemaProperty(name = "优先级")
    private Integer priority;

    @SchemaProperty(name = "业务域")
    private String domain;

    @SchemaProperty(name = "设备管理ip")
    private String mgmtIp;

    @SchemaProperty(name = "物理机房")
    @Size(max = 10, message = "idcs列表元数最大个数为10")
    private List<String> idcs;

    @SchemaProperty(name = "机房")
    @Size(max = 10, message = "iazs列表元数最大个数为10")
    private List<String> iazs;

    @SchemaProperty(name = "集群")
    @Size(max = 10, message = "clusters列表元数最大个数为10")
    private List<String> clusters;

    @SchemaProperty(name = "POD")
    @Size(max = 10, message = "pods列表元数最大个数为10")
    private List<String> pods;

    @SchemaProperty(name = "角色")
    @Size(max = 10, message = "roles列表元数最大个数为10")
    private List<String> roles;

    @SchemaProperty(name = "厂商")
    @Size(max = 10, message = "vendors列表元数最大个数为10")
    private List<String> vendors;

    @SchemaProperty(name = "型号")
    @Size(max = 10, message = "models列表元数最大个数为10")
    private List<String> models;

    @SchemaProperty(name = "设备类型")
    @Size(max = 10, message = "deviceTypes列表元数最大个数为10")
    private List<String> deviceTypes;

    @SchemaProperty(name = "设备管理ip列表")
    @Size(max = 10, message = "mgmtIpList列表元数最大个数为10")
    private List<String> mgmtIpList;

    @SchemaProperty(name = "查询页号，默认值1")
    @NotNull(message = "page字段不能为null且值应该大于等于1")
    @Min(value = 1, message = "page字段值应该大于等于1")
    private Integer page = 1;

    @SchemaProperty(name = "查询页面大小，默认值20")
    @NotNull(message = "size字段不能为null且值应该大于等于1")
    @Min(value = 1, message = "size字段值应该大于等于1")
    private Integer size = 20;

    @SchemaProperty(name = "结果排序方式，默认按操作单id降序排序")
    private List<String> sort = Lists.newArrayList("id", "desc");
}
